<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- 目标: 点击按钮 - 把文字取反显示 - 再点击取反显示(回来了)

提示: 把字符串取反赋予回去 -->
    <div id="app">
        <div>{{msg}}</div>
        <button @click="rev">逆转世界</button>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script>
        const vu = new Vue({
            el: '#app',
            data: {
                msg: 'hello world',

            },
            methods: {
                rev() {
                    const str = this.msg.split('').reverse().join('')
                    this.msg = str
                }

            },
        })
    </script>


</body>

</html>